<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<div class="row" style="padding:0px 10px 10px 0px">
	<div class="col-md-12 col-sm-12 col-lg-12 col-xs-12 text-right">
		<t-auth:roleButton />
	</div>
</div>
<script type="text/javascript">

function quickUp(){
	top.openModal("/cargo/cargo/upCargos?type="+"add","cargo_form","货品详情-添加",1350,550);
}


function addData(){
	top.openModal("/cargo/cargo/singleDetailed?type="+"add","cargo_form","单品上架-添加",1100,550);
}

function addPicture(){
	var id=getKeyId();
	
	var pictureIds=""
	var pictureIdList=[];
	var num=0;
	if(isEditor(id)){
		console.log(id+"fdfd")
			$("#uploaded").uploadFile({multi_selection:true,FileUploaded:function(up, file, info){
				
				if(info.status==200){
					
					var responseJson=JSON.parse(info.response);
					
					if(responseJson.status=="ok"){
						pictureIds=pictureIds+responseJson.id+",";
						pictureIdList.push({
							id:responseJson.id
						})								
				 	}
					 if(num==pictureIdList.length){
						 
						 var url =$.getVirtualPath()+"/cargo/cargo/addPictures";
						 $.ajax({
						        type: 'post',
						        dataType: "json",
						        url: url,
						        data: "pictureIds="+pictureIds+"&cargoId="+id,
						        async: false,
						        success: function (result) {
						        			
						        	$.showTips(result.message,1000,result.resultType);	
						        	location.reload();
						        }
						    });

						}  
					
				}	
			},FilesAdded:function(up, files){
				num=files.length;
				
			}
		});
		
		
		
	}
}

function resizeEx(){
	var parentIframe=window.name;
	if(parentIframe=="relevanceIframe"){
		$("body").css({"cssText":"padding:0px !important",
			"overflow": "hidden"
		});
		$("#tableContent").height($(window).height()-240);
		$(".panel-body").height($(window).height()-225)
	}else{
		$("body").css({
			"cssText":"padding:10px 10px 0px 10px !important",
			"overflow": "hidden"
		});
		$("#tableContent").height($(window).height()-240);
		$(".panel-body").height($(window).height()-220)
	}
}

function editData(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/cargo/cargo/detailed?key="+id,"cargo_form","货品详情-修改",1100,550);
	}
}

function uintSet(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/cargo/cargo/unitSet?key="+id,"unit_form","单位设置",800,475);
	}
}

function selData(){
	var key=getKeyId();
	if(isEditor(key)){
		top.openModal("/cargo/cargo/seeDetailed?key="+key,"cargo_form","货品详情-查看",1100,550);
	
	}
}

function deleteData(){
	 var id=getKeyId();
	 if (isEditor(id)) {
		 var url = $.getVirtualPath()+"/cargo/cargo/delete?key="+id;
		 deleteDataEx(url, searchCallback);
    } 
}

function exportData(){
	var url=$.getVirtualPath()+"/cargo/cargo/exportExcel";
	var data=$("form:first").serialize();
	var cachedId=$.getText(url,data);
	downloadExcel(cachedId);
}
</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/uploaders/uploaders.jsp"%>
<%@ include file="/WEB-INF/views/shared/scripts/uploadFile.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/notifications.jsp"%>
